

<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H+ 后台主题UI框架 - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="__STATIC__/layout/favicon.ico">
     <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
     <!-- jqgrid-->
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <style>
            .checkbox-inline input[type=checkbox],.radio-inline input[type=radio] {
    margin-top: 4px;
}
    </style>
</head>

<body style="color:#333;padding:3px;">
    <!-- 标题 -->
    <div class="page-heade">
       <h2 class="title_color text-center">网点概览</h2>
    </div>
    <!-- 标题 -->
    <div>
    <form action=""  class="form-inline">
      <table class="tab-content table-bordered  table bud_hei" border="1" style="margin-bottom:1px">
      <tr>
		<td colspan="6" class="font-bold">请输入网点编号点击查询按钮或选择网点</td>
      </tr>
      
          <tr>
          <td style="min-width:120px;width: 120px " class="text-center">销售分区</td>
          <td>
       		<select name="" id="fenqu" class="select form-control">
            <option value="0">请选择</option>
            {volist name="fenqu" id="f"}
            <option value="{$f.id}">{$f.title}</option>
            {/volist}
      </select>
			</td>
			 <td style="min-width:120px;width: 120px " class="text-center">销售省/直辖市</td>
          <td>
       		 <select name="" id="sheng" class="select form-control">
        		<option value="0">请选择</option>
				
			</select>
			</td>
			 <td style="min-width:120px;width: 120px " class="text-center">销售市</td>
          <td>
       		 <select name="" id="shi" class="select form-control">
            <option value="0">请选择</option>
      </select>
			</td>
      </tr>
      <tr>
         <td class="text-center">经销商：</td>
		 <td>
			  <select name="" id="jxs" class="select form-control" style="min-width: 360px;">
            <option value="0">请选择</option>
        
      </select>
		 </td>
       <td class="text-center">系统：</td>
     <td>
        <select name="" id="sys" class="select form-control" style="min-width: 360px;">
            <option value="0">请选择</option>
        
      </select>
     </td>
       <td class="text-center">网点：</td>
     <td>
        <select name="" id="net" class="select form-control" style="min-width: 360px;">
            <option value="0">请选择</option>
        
      </select>
     </td>
      </tr>
      <tr id="showNet">
		<td colspan="6">您选择的网点是：<div class="form-group" id="NetSpan"></div><span id="btn"></span></td>
      </tr>
      </table>
</form>
    </div>
    <!-- 全局js -->
    <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
     <script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
    <script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
      <script src="__STATIC__/layout/js/common.js"></script>
    <script>
    function qingkongj(){
          $("#NetSpan").html('');
          $("#btn").html('')

        }
    $("#fenqu").change(function(){
          $("#sheng,#shi,#jxs,#sys,#net").html("<option value='0'>请选择</option>")
          qingkongj()
          var fid=$("#fenqu").val();
          if(fid!=0)
          {
              $.post("{:url('fenqutosheng')}",{fid:fid},function(re){
                    var data=JSON.parse(re);
                    for(var i=0;i<data.length;i++){
                      $("#sheng").append('<option value="'+data[i]["id"]+'">'+data[i]["title"]+'</option>')
                    }
                })
          }
           
        })
        $("#sheng").change(function(){
           $("#shi,#jxs,#sys,#net").html("<option value='0'>请选择</option>")
           qingkongj()
           var pid=$(this).val();
           if(pid!=0){
              $.post("{:url('shengtoshi')}",{pid:pid},function(re){
                    var data=JSON.parse(re);
                    for(var i=0;i<data.length;i++){
                      $("#shi").append('<option value="'+data[i]["id"]+'">'+data[i]["title"]+'</option>')
                    }
                })
           }
        }) 
        $("#shi").change(function(){
          $("#jxs,#sys,#net").html("<option value='0'>请选择</option>")
          qingkongj()
          var cid=$(this).val();
          if(cid!=0){
            $.post("{:url('shitojxs')}",{cid:cid},function(re){
                    var data=JSON.parse(re);
                    for(var i=0;i<data.length;i++){
                      $("#jxs").append('<option value="'+data[i]["id"]+'">'+data[i]["title"]+'</option>')
                    }
                })
          }
        })
        $("#jxs").change(function(){
          $("#sys,#net").html("<option value='0'>请选择</option>")
          qingkongj()
          if($(this).val()!=0){
            $.post("{:url('jxstosys')}",{jid:$(this).val()},function(re){
              var data=JSON.parse(re);
             for(var i=0;i<data.length;i++){
                      $("#sys").append('<option value="'+data[i]["id"]+'">'+data[i]["title"]+'</option>')
                    }
            })
          }
        })
        $("#sys").change(function(){
          $("#net").html("<option value='0'>请选择</option>")
          qingkongj()
          if($(this).val()!=0){
            $.post("{:url('systonet')}",{sid:$(this).val()},function(re){
              var data=JSON.parse(re);
             for(var i=0;i<data.length;i++){
                      $("#net").append('<option value="'+data[i]["id"]+'">'+data[i]["title"]+'</option>')
                    }
            })
          }
        })
        $("#net").change(function(){
          qingkongj()
          if($(this).val()!=0){
            $.post("{:url('getnet')}",{nid:$(this).val()},function(re){
              var data=JSON.parse(re);
              $("#NetSpan").html(data["title"])
              $("#btn").html('<a class="btn-success btn" href=\'{:url("netyj")}?nid='+data["id"]+'\'>查看</a>')
            })
          }
        })
             /*查询*/
             $(".query").click(function(){
            
                    // if($("#cainan").val()==0){
                    //   alert("请选择财年！")
                    // }else if($("#fenqu").val()==0){
                    //    alert("请选择分区！")
                    // }else if($("#province").val()==0){
                    //    alert("请选择省份！")
                    // }else{
                    //     location.href="City_custom_bTod.html"
                    // }
               // console.log(AgencyName.val());
               // console.log(AgencyNum.val());
                });

           var netNum = $("#netNum");
           var netName= $("#netName");
           sousuo(netNum);
           sousuo(netName);

          function sousuo(id){
            id.bsSuggest({
            allowNoKeyword: true, //是否允许无关键字时请求数据
            multiWord: true, //以分隔符号分割的多关键字支持
            separator: ",", //多关键字支持时的分隔符，默认为空格
            getDataMethod: "url", //获取数据的方式，总是从 URL 获取
            url: 'http://unionsug.baidu.com/su?p=3&t=' + (new Date()).getTime() + '&wd=',
            /*优先从url ajax 请求 json 帮助数据，注意最后一个参数为关键字请求参数*/
            jsonp: 'cb',
            /*如果从 url 获取数据，并且需要跨域，则该参数必须设置*/
            processData: function (json) { // url 获取数据时，对数据的处理，作为 getData 的回调函数
                var i, len, data = {
                    value: []
                };
                if (!json || !json.s || json.s.length === 0) {
                    return false;
                }

                // console.log(json);
                len = json.s.length;

                jsonStr = "{'value':[";
                for (i = 0; i < len; i++) {
                    data.value.push({
                        word: json.s[i]
                    });
                }
                data.defaults = 'baidu';

                //字符串转化为 js 对象
                return data;
            }
        });

          }
         
    </script>
</body>

</html>
